//
//  HeaderCollectionReusableView.m
//  BeanTrip
//
//  Created by dlios on 15-6-30.
//  Copyright (c) 2015年 PandaGroup. All rights reserved.
//

#import "HeaderCollectionReusableView.h"
#import "EuropeViewController.h"
@implementation HeaderCollectionReusableView
- (void)dealloc
{
    [_myLabel release];
    [_myButton release];
    [super dealloc];
}
-(instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.myLabel = [[UILabel alloc] init];
        self.myLabel.backgroundColor = [UIColor whiteColor];
        [self addSubview:self.myLabel];
    }
    return self;
}
/**
 *  不一定要走该方法,只有创建时候才会走
 */
-(void)layoutSubviews
{
    [super layoutSubviews];
    self.myLabel.frame = CGRectMake(10, 5, 150, 30);
}
/**
 *  必须要走此方法
 *
 *  @param isAdd 是否添加箭头
 */
- (void)setIsAdd:(BOOL)isAdd
{
    _isAdd = isAdd;
    [self isAddButton];
}


-(void)isAddButton
{
    if(self.isAdd==YES){
        self.myButton=[UIButton buttonWithType:UIButtonTypeCustom];
        self.myButton.frame=CGRectMake(self.frame.size.width-40, 5,40, 30);
        [self.myButton setImage:[UIImage imageNamed:@"destination_enter_button"] forState:UIControlStateNormal];
        [self addSubview:self.myButton];
    }
    else
    {
        [self.myButton removeFromSuperview];
    }
}
@end
